package AdapterSlf4j;

import logging.Level;

import org.slf4j.Logger;
import org.slf4j.Marker;
import org.slf4j.helpers.FormattingTuple;
import org.slf4j.helpers.MessageFormatter;

public class LoggerAdapter implements Logger{

	private String nameLogger;
	private logging.Logger logger;
	
	public LoggerAdapter(String name){
		nameLogger = name;
		logger = new logging.Logger(nameLogger);
	}

	@Override
	public String getName() {
		return nameLogger;
	}

	@Override
	public boolean isTraceEnabled() {
		return (logger.getLevel().equals(Level.TRACE));
	}

	@Override
	public void trace(String msg) {
		logger.trace(msg);
	}

	@Override
	public void trace(String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.trace(formatingTuple.getMessage());
	}

	@Override
	public void trace(String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.trace(formatingTuple.getMessage());
	}

	@Override
	public void trace(String format, Object... arguments) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, arguments);
		logger.trace(formatingTuple.getMessage());
	}

	@Override
	public void trace(String msg, Throwable t) {
		logger.trace(msg, t);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public boolean isTraceEnabled(Marker marker) {
		return (logger.getLevel().equals(Level.TRACE));
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void trace(Marker marker, String msg) {
		logger.trace(msg);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void trace(Marker marker, String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.trace(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void trace(Marker marker, String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.trace(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void trace(Marker marker, String format, Object... argArray) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, argArray);
		logger.trace(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void trace(Marker marker, String msg, Throwable t) {
		logger.trace(msg, t);
	}

	@Override
	public boolean isDebugEnabled() {
		return (logger.getLevel().equals(Level.DEBUG));
	}

	@Override
	public void debug(String msg) {
		logger.debug(msg);
	}

	@Override
	public void debug(String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.debug(formatingTuple.getMessage());
	}

	@Override
	public void debug(String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.debug(formatingTuple.getMessage());	
	}

	@Override
	public void debug(String format, Object... arguments) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, arguments);
		logger.debug(formatingTuple.getMessage());
	}

	@Override
	public void debug(String msg, Throwable t) {
		logger.debug(msg, t);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public boolean isDebugEnabled(Marker marker) {
		return (logger.getLevel().equals(Level.DEBUG));
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void debug(Marker marker, String msg) {
		logger.debug(msg);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void debug(Marker marker, String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.debug(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void debug(Marker marker, String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.debug(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void debug(Marker marker, String format, Object... arguments) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, arguments);
		logger.debug(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void debug(Marker marker, String msg, Throwable t) {
		logger.debug(msg, t);;
	}

	@Override
	public boolean isInfoEnabled() {
		return (logger.getLevel().equals(Level.INFO));
	}

	@Override
	public void info(String msg) {
		logger.info(msg);
	}

	@Override
	public void info(String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.info(formatingTuple.getMessage());
	}

	@Override
	public void info(String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.info(formatingTuple.getMessage());
	}

	@Override
	public void info(String format, Object... arguments) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, arguments);
		logger.info(formatingTuple.getMessage());
	}

	@Override
	public void info(String msg, Throwable t) {
		logger.info(msg, t);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public boolean isInfoEnabled(Marker marker) {
		return (logger.getLevel().equals(Level.INFO));
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void info(Marker marker, String msg) {
		logger.info(msg);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void info(Marker marker, String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.info(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void info(Marker marker, String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.info(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void info(Marker marker, String format, Object... arguments) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, arguments);
		logger.info(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void info(Marker marker, String msg, Throwable t) {
		logger.info(msg, t);
	}

	@Override
	public boolean isWarnEnabled() {
		return (logger.getLevel().equals(Level.WARN));
	}

	@Override
	public void warn(String msg) {
		logger.warn(msg);
	}

	@Override
	public void warn(String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.warn(formatingTuple.getMessage());
	}

	@Override
	public void warn(String format, Object... arguments) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, arguments);
		logger.warn(formatingTuple.getMessage());
	}

	@Override
	public void warn(String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.warn(formatingTuple.getMessage());
	}

	@Override
	public void warn(String msg, Throwable t) {
		logger.warn(msg, t);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public boolean isWarnEnabled(Marker marker) {
		return (logger.getLevel().equals(Level.WARN));
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void warn(Marker marker, String msg) {
		logger.warn(msg);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void warn(Marker marker, String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.warn(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void warn(Marker marker, String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.warn(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void warn(Marker marker, String format, Object... arguments) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, arguments);
		logger.warn(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void warn(Marker marker, String msg, Throwable t) {
		logger.warn(msg, t);
	}

	@Override
	public boolean isErrorEnabled() {
		return (logger.getLevel().equals(Level.ERROR));
	}

	@Override
	public void error(String msg) {
		logger.error(msg);
	}

	@Override
	public void error(String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.error(formatingTuple.getMessage());	
	}

	@Override
	public void error(String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.error(formatingTuple.getMessage());		
	}

	@Override
	public void error(String format, Object... arguments) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, arguments);
		logger.error(formatingTuple.getMessage());	
	}

	@Override
	public void error(String msg, Throwable t) {
		logger.error(msg, t);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public boolean isErrorEnabled(Marker marker) {
		return (logger.getLevel().equals(Level.ERROR));
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void error(Marker marker, String msg) {
		logger.error(msg);
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void error(Marker marker, String format, Object arg) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg);
		logger.error(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void error(Marker marker, String format, Object arg1, Object arg2) {
		FormattingTuple formatingTuple = MessageFormatter.format(format, arg1, arg2);
		logger.error(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void error(Marker marker, String format, Object... arguments) {
		FormattingTuple formatingTuple = MessageFormatter.arrayFormat(format, arguments);
		logger.error(formatingTuple.getMessage());
	}

	/*
	 * the marker is ignored
	 */
	@Override
	public void error(Marker marker, String msg, Throwable t) {
		logger.error(msg, t);
	}
}
